<?php

namespace app\admin\controller;
use app\base\controller\Base;
use think\Request;
use think\Cache;
use think\Config;
use think\Session;

//
class Position extends Base
{
    public  $model;

    public function __construct()
    {
   $this->model = model("PcSitePosition");
        parent::__construct();
    }

    /**
     * 显示位置列表
     *
     * @return \think\Response
     */
    public function index()
    {//
        $where = [];
        //时间的处理


        $res =   $this->model->AdminPageNoAgent($where);
        if(empty($res)){
            return failJson("暂无记录");
        }
        return   resJson(1,$this->ecLang("query"),$res['res'],$res['pageInfo']);
    }


    /**
     *  添加位置
     */
    public function save(){
        $data = $this->RealData;
        $res = $this->model->save($data);
        if(!$res){
                return failJson("添加站点位置失败");
        }
        return sucessJson("添加站点位置成功");

    }

    /**
     * @return \think\response\Json 位置信息修改
     */
    public function up(){
        $data = $this->RealData;
        $res = $this->model->save($data,['id'=>$this->RealData['id']]);
        if(!$res){
            return failJson("更新位置配置失败");
        }
        return sucessJson("更新位置配置成功");
    }
}
